package 力扣._2598_执行操作后的最大MEX;

import java.util.HashMap;
import java.util.Map;

class Solution {
    public int findSmallestInteger(int[] nums, int value) {
        int[] cnt = new int[value];
        for(int x : nums){
            cnt[((x%value)+value)%value]++;
        }
        int ans = 0;
        while (cnt[ans%value] > 0){
            cnt[ans%value]--;
            ans++;
        }
        return ans;
    }

    public static void main(String[] args) {
        Solution s = new Solution();
        System.out.println(s.findSmallestInteger(new int[]{0,-3}, 4));
    }
}